<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="js/jquery.js"></script>
        <link rel="icon" type="image/ico" href="imagens/favicon.ico"/>
        <link rel="stylesheet" type="text/css" href="css/login.css">
        <title>NiceShot!</title>

    </head>



    <body>

        <div class="container">
            <div class="row vertical-offset-100">
                <div class="col-md-4 col-md-offset-4">
                    <div class="panel panel-default" id="divLogin">
                        <div class="panel-heading">                                
                            <div class="row-fluid user-row">
                                <img src="imagens/nshotnewlogo.png" class="img-responsive" alt="Conxole Admin"/>
                            </div>
                        </div>
                        <div class="panel-body">
                            <form id="frmLogin" method="POST" action="LoginServlet" accept-charset="UTF-8" role="form" class="form-signin">
                                <fieldset>
                                    <label class="panel-login">

                                    </label>
                                    <input class="form-control" placeholder="Usuário" name="usuario" id="usuario" type="text" required>
                                    <input class="form-control" placeholder="Senha" name="senha" id="senha" type="password" required>
                                    <br></br>
                                    <input class="btn btn-lg btn-danger btn-block" type="submit" id="login" value="Entrar">
                                </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <%@include file="includes/api.jsp" %>
        <%@include file="includes/modal.jsp" %>
        <script src="js/loginJS.js"></script>


        <script type="text/javascript">

            var form = $('#frmLogin');
            form.submit(function () {
                $.ajax({
                    type: form.attr('method'),
                    url: form.attr('action'),
                    data: form.serialize(),
                    success: function (data) {

                        if (data != "") {
                            $('#bodyModal').find(".row").remove();
                            $('#iconModal').html('');
                            $('#bodyModal').append(data);
                            $('#bModal').modal('show');
                            $('#bModal').on('hidden.bs.modal', function () {
                                location.reload();
                            })
                        } else {
                            window.location.replace("agendadia.jsp");
                        }


                    }
                });

                return false;

            });



        </script>
    </body>
</html>